<?php defined('IN_NWIDC') or exit('Access Invalid!');?>

<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3><?php echo $lang['nc_pay_method'];?></h3>
      <ul class="tab-base"><li><a class="current"><span><?php echo $lang['nc_pay_method'];?></span></a></li>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="post_form" method="post" name="form1" enctype="multipart/form-data">
    <input type="hidden" name="form_submit" value="ok" />
    <input type="hidden" name="payment_id" value="<?php echo $output['payment']['payment_id'];?>" />
    <table class="table tb-type2 nobdb">
      <tbody>
        <tr class="noborder">
          <td class="vatop rowform"><?php echo $output['payment']['payment_name'];?></td>
          <td class="vatop tips"></td>
        </tr>
        <?php if ($output['payment']['payment_code'] == 'chinabank') { ?>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_chinabank_account'];?>: </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="hidden" name="config_name" value="chinabank_account,chinabank_key" />
            <input name="chinabank_account" id="chinabank_account" value="<?php echo $output['config_array']['chinabank_account'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_chinabank_key'];?>:
            </th></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input name="chinabank_key" id="chinabank_key" value="<?php echo $output['config_array']['chinabank_key'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <?php } elseif ($output['payment']['payment_code'] == 'tenpay') { ?>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_tenpay_account'];?>:
            </th></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="hidden" name="config_name" value="tenpay_account,tenpay_key" />
            <input name="tenpay_account" id="tenpay_account" value="<?php echo $output['config_array']['tenpay_account'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_tenpay_key'];?>: </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input name="tenpay_key" id="tenpay_key" value="<?php echo $output['config_array']['tenpay_key'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <?php } elseif ($output['payment']['payment_code'] == 'alipay') { ?>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_alipay_account'];?>: </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="hidden" name="config_name" value="alipay_service,alipay_account,alipay_key,alipay_partner" />
          	<input type="hidden" name="alipay_service" value="create_direct_pay_by_user" />
            <input name="alipay_account" id="alipay_account" value="<?php echo $output['config_array']['alipay_account'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_alipay_key'];?>: </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input name="alipay_key" id="alipay_key" value="<?php echo $output['config_array']['alipay_key'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_alipay_partner'];?>: </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input name="alipay_partner" id="alipay_partner" value="<?php echo $output['config_array']['alipay_partner'];?>" class="txt" type="text"></td>
          <td class="vatop tips"><a href="https://b.alipay.com/order/pidKey.htm?pid=2088001525694587&product=fastpay" target="_blank">get my key and partner ID</a></td>
        </tr>
        <?php } ?>
        <?php if ($output['payment']['payment_code'] == 'wxpay') { ?>
        <tr>
            <td colspan="2" class="required"><label class="validation">公众账号ID（appid）:</label> </td>
        </tr>
        <tr class="noborder">
          <td style='display:none'>
            <input type="hidden" name="config_name" value="appid,mch_id,key,appsecret" />
          </td>
          <td class="vatop rowform"><input name="appid" id="appid" value="<?php echo $output['config_array']['appid'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
            <td colspan="2" class="required"><label class="validation">商户号（mch_id）: </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input name="mch_id" id="mch_id" value="<?php echo $output['config_array']['mch_id'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
         <tr>
            <td colspan="2" class="required"><label class="validation">商户支付密钥（key）: </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input name="key" id="key" value="<?php echo $output['config_array']['key'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
         <tr>
            <td colspan="2" class="required"><label class="validation">公众帐号secert（appsecret）: </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input name="appsecret" id="appsecret" value="<?php echo $output['config_array']['appsecret'];?>" class="txt" type="text"></td>
          <td class="vatop tips"></td>
        </tr>
        <?php } ?>

        <!-- 汇聚支付 - begin -->
        <?php if ($output['payment']['payment_code'] == 'joinpay1' || $output['payment']['payment_code'] == 'joinpay2'){ ?>

            <input type="hidden" name="config_name" value="merchantNo,merchantKey">
            <tr>
                <td colspan="2" class="required"><label class="validation">商户编号: </label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="merchantNo" id="merchantNo" value="<?php echo $output['config_array']['merchantNo'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>
            <tr>
                <td colspan="2" class="required"><label class="validation">商户密钥: </label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="merchantKey" id="merchantKey" value="<?php echo $output['config_array']['merchantKey'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>
        <?php  } ?>
        <!-- 汇聚支付 - end -->

        <?php if ($output['payment']['payment_code'] == 'abcpay' || $output['payment']['payment_code'] == 'abcpay2'){ ?>
            <input type="hidden" name="payment_code" value="<?php echo $output['payment']['payment_code']?>">
            <input type="hidden" name="config_name" value="merchantid,merchantcertpassword">
        <tr>
            <td colspan="2" class="required"><label class="validation">商户编号: </label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform"><input name="merchantid" id="merchantid" value="<?php echo $output['config_array']['merchantid'];?>" class="txt" type="text"></td>
            <td class="vatop tips"></td>
         </tr>

        <tr>
            <td colspan="2" class="required"><label class="validation">商户证书储存: </label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform"><input value="/shop/api/payment/<?php echo $output['payment']['payment_code'] ?>/cert/merchant.pfx" class="txt" disabled></td>
            <td>
                <input type="file" name="file">
            </td>
            <td class="vatop tips"></td>

        </tr>

        <tr>
            <td colspan="2" class="required"><label class="validation">商户私钥加密密码: </label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform"><input name="merchantcertpassword" id="merchantcertpassword" value="<?php echo $output['config_array']['merchantcertpassword'];?>" class="txt" type="text"></td>
            <td class="vatop tips"></td>
        </tr>
        <?php } ?>

        <?php if ($output['payment']['payment_code'] == 'zhifub2c' || $output['payment']['payment_code'] == 'zhifuqr' ) { ?>
            <tr style="display:none;">
                <input type="hidden" name="config_name" value="merchant_code,private_key,public_key,dinpay_public_key" />
            </tr>
            <tr>
                <td colspan="2" class="required"><label class="validation">商户号:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="merchant_code" id="merchant_code" value="<?php echo $output['config_array']['merchant_code'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">商户私钥:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="private_key" id="private_key"cols="30" rows="10"><?php echo $output['config_array']['private_key'];?></textarea>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">商户公钥:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="public_key" id="public_key"cols="60" rows="10"><?php echo $output['config_array']['public_key'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">智付公钥:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="dinpay_public_key" id="dinpay_public_key"cols="60" rows="10"><?php echo $output['config_array']['dinpay_public_key'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>

        <?php } ?>
        <?php if ($output['payment']['payment_code'] == 'abcpay' || $output['payment']['payment_code'] == 'abcpay2'){ ?>
            <input type="hidden" name="payment_code" value="<?php echo $output['payment']['payment_code']?>">
            <input type="hidden" name="config_name" value="merchantid,merchantcertpassword">
            <tr>
                <td colspan="2" class="required"><label class="validation">商户编号: </label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="merchantid" id="merchantid" value="<?php echo $output['config_array']['merchantid'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">商户证书储存: </label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input value="/shop/api/payment/<?php echo $output['payment']['payment_code'] ?>/cert/merchant.pfx" class="txt" disabled></td>
                <td>
                    <input type="file" name="file">
                </td>
                <td class="vatop tips"></td>

            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">商户私钥加密密码: </label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="merchantcertpassword" id="merchantcertpassword" value="<?php echo $output['config_array']['merchantcertpassword'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>
        <?php } ?>

        <?php if ($output['payment']['payment_code'] == 'tlwangguan') { ?>
            <tr style="display:none;">
                <input type="hidden" name="config_name" value="merchant_code,address,signkey,beian_code,beian_name" />
            </tr>
            <tr>
                <td colspan="2" class="required"><label class="validation">商户号:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="merchant_code" id="merchant_code" value="<?php echo $output['config_array']['merchant_code'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">提交地址:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="address" id="address"cols="30" rows="10"><?php echo $output['config_array']['address'];?></textarea>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">signkey:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="signkey" id="signkey"cols="60" rows="10"><?php echo $output['config_array']['signkey'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>
			
			
			<tr>
                <td colspan="2" class="required"><label class="validation">海关备案号:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="beian_code" id="beian_code"cols="60" rows="10"><?php echo $output['config_array']['beian_code'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>
			
			
			<tr>
                <td colspan="2" class="required"><label class="validation">海关备案名称:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="beian_name" id="beian_name"cols="60" rows="10"><?php echo $output['config_array']['beian_name'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>


        <?php } ?>

        <?php if ($output['payment']['payment_code'] == 'tl2' || $output['payment']['payment_code'] == 'tl4') { ?>
            <tr style="display:none;">
                <input type="hidden" name="config_name" value="merchant_code,address,signkey,appid" />
            </tr>
            <tr>
                <td colspan="2" class="required"><label class="validation">商户号:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="merchant_code" id="merchant_code" value="<?php echo $output['config_array']['merchant_code'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">提交地址:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="address" id="address"cols="30" rows="10"><?php echo $output['config_array']['address'];?></textarea>
                <td class="vatop tips"></td>
            </tr>

<tr>
                <td colspan="2" class="required"><label class="validation">appid:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="appid" id="appid"cols="60" rows="10"><?php echo $output['config_array']['appid'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>
            <tr>
                <td colspan="2" class="required"><label class="validation">signkey:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="signkey" id="signkey"cols="60" rows="10"><?php echo $output['config_array']['signkey'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>
      
        <?php } ?>

         <?php if ($output['payment']['payment_code'] == 'tl3') { ?>
            <tr style="display:none;">
                <input type="hidden" name="config_name" value="brhId,address,app_key,req_secret.res_secret,mer_id,激活卡" />
            </tr>
            <tr>
                <td colspan="2" class="required"><label class="validation">brhId:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input name="brhId" id="brhId" value="<?php echo $output['config_array']['brhId'];?>" class="txt" type="text"></td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">提交地址:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="address" id="address"cols="30" rows="10"><?php echo $output['config_array']['address'];?></textarea>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">app_key:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="app_key" id="app_key"cols="60" rows="10"><?php echo $output['config_array']['app_key'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">req_secret:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="req_secret" id="req_secret"cols="60" rows="10"><?php echo $output['config_array']['req_secret'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>

             <tr>
                 <td colspan="2" class="required"><label class="validation">res_secret:</label></td>
             </tr>
             <tr class="noborder">
                 <td class="vatop rowform">
                     <textarea name="res_secret" id="res_secret"cols="60" rows="10"><?php echo $output['config_array']['res_secret'];?></textarea>
                 </td>
                 <td class="vatop tips"></td>
             </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">mer_id:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="mer_id" id="mer_id"cols="60" rows="10"><?php echo $output['config_array']['mer_id'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>

            <tr>
                <td colspan="2" class="required"><label class="validation">激活卡:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">
                    <textarea name="激活卡" id="激活卡"cols="60" rows="10"><?php echo $output['config_array']['激活卡'];?></textarea>
                </td>
                <td class="vatop tips"></td>
            </tr>
      
        <?php } ?>
        <tr>
          <td colspan="2" class="required"><?php echo $lang['payment_index_enable'];?>: </td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform onoff"><label for="payment_state1" class="cb-enable <?php if($output['payment']['payment_state'] == '1'){ ?>selected<?php } ?>" ><span><?php echo $lang['nc_yes'];?></span></label>
            <label for="payment_state2" class="cb-disable <?php if($output['payment']['payment_state'] == '0'){ ?>selected<?php } ?>" ><span><?php echo $lang['nc_no'];?></span></label>
            <input type="radio" <?php if($output['payment']['payment_state'] == '1'){ ?>checked="checked"<?php }?> value="1" name="payment_state" id="payment_state1">
            <input type="radio" <?php if($output['payment']['payment_state'] == '0'){ ?>checked="checked"<?php }?> value="0" name="payment_state" id="payment_state2"></td>
          <td class="vatop tips"></td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"  onclick="document.form1.submit()"><span><?php echo $lang['nc_submit'];?></span></a> <a href="JavaScript:void(0);" class="btn" onclick="history.go(-1)"><span><?php echo $lang['nc_back'];?></span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<script>
$(document).ready(function(){

	$('#post_form').validate({
		<?php if($output['payment']['payment_code'] == 'chinabank') { ?>
        rules : {
            chinabank_account : {
                required   : true
            },
            chinabank_key : {
                required   : true
            }
        },
        messages : {
            chinabank_account  : {
                required  : '<?php echo $lang['payment_chinabank_account'];?><?php echo $lang['payment_edit_not_null']; ?>'
            },
            chinabank_key  : {
                required   : '<?php echo $lang['payment_chinabank_key'];?><?php echo $lang['payment_edit_not_null']; ?>'
            }
        }
		<?php } elseif ($output['payment']['payment_code'] == 'tenpay') { ?>
        rules : {
            tenpay_account : {
                required   : true
            },
            tenpay_key : {
                required   : true
            }
        },
        messages : {
            tenpay_account  : {
                required  : '<?php echo $lang['payment_tenpay_account'];?><?php echo $lang['payment_edit_not_null']; ?>'
            },
            tenpay_key  : {
                required   : '<?php echo $lang['payment_tenpay_key'];?><?php echo $lang['payment_edit_not_null']; ?>'
            }
        }

		<?php } elseif ($output['payment']['payment_code'] == 'alipay') { ?>
        rules : {
            alipay_account : {
                required   : true
            },
            alipay_key : {
                required   : true
            },
            alipay_partner : {
                required   : true
            }
        },
        messages : {
            alipay_account  : {
                required  : '<?php echo $lang['payment_alipay_account'];?><?php echo $lang['payment_edit_not_null']; ?>'
            },
            alipay_key  : {
                required   : '<?php echo $lang['payment_alipay_key'];?><?php echo $lang['payment_edit_not_null']; ?>'
            },
            alipay_partner  : {
                required   : '<?php echo $lang['payment_alipay_partner'];?><?php echo $lang['payment_edit_not_null']; ?>'
            }
        }
    <?php }elseif ($output['payment']['payment_code'] == 'wxpay') { ?>
        rules : {
            appid : {
                required   : true
            },
            mch_id : {
                required   : true
            },
            key : {
                required   : true
            },
            appsecret : {
                required   : true
            }
        },
        messages : {
            // appid  : {
            //     required  : '<?php echo $lang['payment_alipay_account'];?><?php echo $lang['payment_edit_not_null']; ?>'
            // },
            // mch_id  : {
            //     required   : '<?php echo $lang['payment_alipay_key'];?><?php echo $lang['payment_edit_not_null']; ?>'
            // },
            // key  : {
            //     required   : '<?php echo $lang['payment_alipay_partner'];?><?php echo $lang['payment_edit_not_null']; ?>'
            // },
            // appsecret : {

            // }
        }
    <?php } ?>
    });
});
</script>